<!--  -->
<template>
  <div class="list">
    <el-table :data="tableData" style="width: 100%">
      <el-table-column type="index" width="50">
      </el-table-column>
      <el-table-column prop="name" label="标识类型" width="180">
      </el-table-column>
      <el-table-column prop="remark" label="说明" width="180">
      </el-table-column>
      <el-table-column prop="state" label="状态">
      </el-table-column>
      <el-table-column label="操作" width="100">
        <template slot-scope="scope">
          <el-button type="text" size="small">修改</el-button>
          <el-button type="text" size="small" @click="bindMaterial(scope.row)">绑定</el-button>
        </template>
      </el-table-column>
    </el-table>
    <BindMaterial :openDialog="openDialog" @closeDialog="closeDialog" :templateUuid="templateUuid"></BindMaterial>
  </div>
</template>

<script>
import BindMaterial from './BindMaterial';
export default {
  name: 'List',
  components: {
    BindMaterial
  },
  data () {
    return {
      tableData: [],
      openDialog: false,
      templateUuid: ''
    }
  },


  watch: {},

  mounted () {
    this.getTableList()
  },

  methods: {
    getTableList () {
      // var _this = this
      //get传递参数
      this.axios.get('/MKL/template/queryTemplate', {
        params: {
          projectUuid: '06b987ba-5263-4fb3-81a1-b51217e81201',
          page: 0,
          size: 15,
          name: ''
        }
      })
        .then((res) => {
          // console.log(res)
          this.tableData = res.data.content
        })

      //post请求
      // this.axios.post('url',qs.stringify(this.from))
      // .then((response)=>{
      // //...
      // })
    },
    bindMaterial (row) {
      this.openDialog = true
      this.templateUuid = row.uuid
    },
    closeDialog () {
      this.openDialog = false
    }
  }
}
</script>
<style lang='stylus' scoped></style>